<style scoped>
  .picImg {
    width: 40px;
    height: 40px;
  }
  .el-menu{
    border:0;
    display: flex;
  }
</style>
<template>
  <div class="app-container">
    <div class="filter-container">
      <el-menu default-active="2" class="el-menu-vertical-demo">
        <el-menu-item index="2" @click="active1()">
          <i class="el-icon-tickets" style="font-size:24px;"></i>
          <span slot="title">基本信息</span>
        </el-menu-item>
        <el-menu-item index="3" @click="active2()">
          <i class="el-icon-share" style="font-size:24px;"></i>
          <span slot="title">三方管理</span>
        </el-menu-item>
        <el-menu-item index="4" @click="active3()">
          <i class="el-icon-menu" style="font-size:24px;"></i>
          <span slot="title">分公司</span>
        </el-menu-item>
      </el-menu>
    </div>
    <!--&lt;!&ndash; 基本信息 &ndash;&gt;-->
    <el-table v-if="show1" v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row
              :header-cell-style="{background:'#92D3FF',color:'#fff'}">
      <!--<el-table-column align="center" min-width="100" label="备注" prop="remark"/>-->
      <el-table-column align="center" min-width="100" label="表单编号" prop="formNo"/>
      <el-table-column align="center" min-width="100" label="回款金额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="回款时间" prop="repayTime"/>
      <el-table-column align="center" min-width="100" label="保险公司名称" prop="suranceName"/>
      <el-table-column align="center" min-width="100" label="保代公司名称" prop="agentName"/>
      <el-table-column align="center" min-width="100" label="保理公司名称" prop="factoringName"/>
      <el-table-column align="center" min-width="100" label="关联类型" prop="formType">
        <template slot-scope="scope">
          <el-tag>{{{"0":"保代公司","1":"权益服务商"}[scope.row.formType]}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="100" label="保单总数" prop="billCount"/>
      <el-table-column align="center" min-width="100" label="手续费总额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="上传备注" prop="remarkUp"/>
    </el-table>

    <!--==========三方管理=====-->
    <el-table v-if="show2" v-loading="listLoading" :data="list1" element-loading-text="正在查询中。。。" border fit highlight-current-row
              :header-cell-style="{background:'#92D3FF',color:'#fff'}">
      <!--<el-table-column align="center" min-width="100" label="备注" prop="remark"/>-->
      <el-table-column align="center" min-width="100" label="form" prop="formNo"/>
      <el-table-column align="center" min-width="100" label="回款金额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="回款时间" prop="repayTime"/>
      <el-table-column align="center" min-width="100" label="保险公司名称" prop="suranceName"/>
      <el-table-column align="center" min-width="100" label="保代公司名称" prop="agentName"/>
      <el-table-column align="center" min-width="100" label="保理公司名称" prop="factoringName"/>
      <el-table-column align="center" min-width="100" label="关联类型" prop="formType">
        <template slot-scope="scope">
          <el-tag>{{{"0":"保代公司","1":"权益服务商"}[scope.row.formType]}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="100" label="保单总数" prop="billCount"/>
      <el-table-column align="center" min-width="100" label="手续费总额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="上传备注" prop="remarkUp"/>
      <!--<el-table-column fixed="right" align="center" label="操作" width="250" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="primary" size="mini"
                     @click="detail(scope.row)">详情
          </el-button>
        </template>
      </el-table-column>-->
    </el-table>

    <!--========分公司=======-->
    <el-table v-if="show3" v-loading="listLoading" :data="list2" element-loading-text="正在查询中。。。" border fit highlight-current-row
              :header-cell-style="{background:'#92D3FF',color:'#fff'}">
      <!--<el-table-column align="center" min-width="100" label="备注" prop="remark"/>-->
      <el-table-column align="center" min-width="100" label="id" prop="formNo"/>
      <el-table-column align="center" min-width="100" label="回款金额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="回款时间" prop="repayTime"/>
      <el-table-column align="center" min-width="100" label="保险公司名称" prop="suranceName"/>
      <el-table-column align="center" min-width="100" label="保代公司名称" prop="agentName"/>
      <el-table-column align="center" min-width="100" label="保理公司名称" prop="factoringName"/>
      <el-table-column align="center" min-width="100" label="关联类型" prop="formType">
        <template slot-scope="scope">
          <el-tag>{{{"0":"保代公司","1":"权益服务商"}[scope.row.formType]}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" min-width="100" label="保单总数" prop="billCount"/>
      <el-table-column align="center" min-width="100" label="手续费总额 (元)" prop="amount"/>
      <el-table-column align="center" min-width="100" label="上传备注" prop="remarkUp"/>
      <!--<el-table-column fixed="right" align="center" label="操作" width="250" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button type="primary" size="mini"
                     @click="detail(scope.row)">表单详情
          </el-button>
        </template>
      </el-table-column>-->
    </el-table>
  </div>
</template>

<script>
  import {doGet, doPost} from '@/api'
  import {cities} from '@/utils/base'
  import Pagination from '@/components/Pagination' // Secondary package based on el-pagination

  export default {
    name: 'bank',
    components: {Pagination},
    filters: {},
    data() {
      return {
        show1: true,
        show2: false,
        show3: false,
        list: [],
        list1: [],
        list2: [],
        total: 0,
        listLoading: true,
        listLoading1: true,
        listQuery: {
          startTime: undefined,
          endTime: undefined,
          agentID: undefined,
          factoringID: undefined
        },
        editForm: {
          id: undefined,
          billNo: undefined,
          billAmount: undefined,
          fee: undefined,
          agentID: undefined,
          agentNo: undefined,
          formType: undefined,
        },
        editDialogVisible: false,
      }
    },
    created() {
    this.getList1()
    },
    methods: {
      getList1() {
        this.listLoading = true
        doGet('repaysearch.html?op=list', this.listQuery).then(response => {
          this.list = response.rows
          this.total = response.rows.length
          this.listLoading = false
        }).catch(() => {
          this.list = []
          this.total = 0
          this.listLoading = false
        })
      },
      getList2() {
        this.listLoading = true
        doGet('repaysearch.html?op=list', this.listQuery).then(response => {
          this.list1 = response.rows
          this.total = response.rows.length
          this.listLoading = false
        }).catch(() => {
          this.list1 = []
          this.total = 0
          this.listLoading = false
        })
      },
      getList3() {
        this.listLoading = true
        doGet('repaysearch.html?op=list', this.listQuery).then(response => {
          this.list2 = response.rows
          this.total = response.rows.length
          this.listLoading = false
        }).catch(() => {
          this.list2 = []
          this.total = 0
          this.listLoading = false
        })
      },
      detail(row) {
        this.editDialogVisible = true
        this.listLoading1 = true
        this.editForm1 ={
          id: row.id,
          formType: row.formType,
        }
//        console.log(row.id)
        doGet('repaysearch.html?op=billlist', this.editForm1).then(response => {
          console.log(response);
          this.list1 = response.rows
          this.listLoading1 = false
//          this.editForm.id = response.rows.id;
//          this.editForm.billNo = response.rows.billNo;
//          this.editForm.billAmount = response.rows.billAmount;
//          this.editForm.fee = response.rows.fee;
//          this.editForm.agentID = response.rows.agentID;
//          this.editForm.agentNo = response.rows.agentNo
        }).catch(() => {
          this.list = [];
          this.total = 0;
          this.listLoading1 = false
        })
      },
      active1() {
        this.getList1()
        if(this.show1 = true) {
          this.show2 = false
          this.show3 = false
        }
      },
      active2() {
        this.getList2()
        if (this.show2 = true) {
          this.show1 = false
          this.show3 = false
        }
      },
      active3() {
        this.getList3()
        if (this.show3 = true){
          this.show1 = false
          this.show2 = false
        }
      },
    }
  }
</script>
